package model.types;


/**
 * Natural Numbers.  
 * Nat is a subset of Int having numerator >= 0;
 * 
 * @author Marius Tempelmeier
 *
 */
public class Nat extends Int {

	public Nat(int numerator) throws NumberFormatException {
		super(numerator);
		if (numerator < 0) {
			throw new NumberFormatException("Nat must be positive integer");
		}
	}
	
	
	/**
	 * Returns this as <tt>Int</tt>. 
	 * @return this as <tt>Int</tt>
	 */
	public Int toInt() {
		return new Int(this.getNumerator()); 
	}
	
	/**
	 * Returns this as <tt>Rat</tt>. 
	 * @return this as <tt>Rat</tt>
	 */
	public Rat toRat() {
		return new Rat(this.getNumerator(), 1); 
	}
}
